<template>
	<view style="height: 100vh;overflow: hidden;">
		<image :src="qidong" class="height-screen" style="width: 100vw;" />
	</view>
</template>

<script>
	import {
		qidongImage
	} from '@/apis'
	export default {
		data() {
			return {
				qidong: '',
				currentTime: 0,
				timeInterval: ''
			}
		},
		onShow() {
			this.currentTime = 0
			this.qidongImage()
			this.timeInterval = setInterval(() => {
				this.jump()
			}, 1000)
		},
		methods: {
			async qidongImage() {
				const res = await qidongImage()
				this.qidong = this.helper.handleImage(res)
			},
			async jump() {
				this.currentTime++
				if (this.currentTime >= 3) {
					let token = uni.getStorageSync('token')
					clearInterval(this.timeInterval)
					uni.reLaunch({
						url: '/pages/tabBar/home'
					})
					// if (!token) {
					// 	clearInterval(this.timeInterval)
					// 	uni.reLaunch({
					// 		url: '/pages/tabBar/login'
					// 	})
					// } else {

					// 	clearInterval(this.timeInterval)
					// 	uni.reLaunch({
					// 		url: '/pages/tabBar/home'
					// 	})
					// }
				}
			}
		}
	}
</script>

<style lang="scss" scoped>
</style>